using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.Configuration;
using System.Web;

namespace Ent.Web.Helper
{
    public class ContentHelper
    {
        private static Dictionary<string, string> _contents;
        static Dictionary<string, string> Contents
        {
            get
            {
                if (_contents == null)
                    Ent.Web.Helper.ContentHelper.Init(ConfigurationManager.AppSettings.Get("Content"));
                return _contents;
            }
        }
        public static void Init(string path)
        {
            path = HttpRuntime.AppDomainAppPath + "/" + path;
            if (_contents == null)
            {
                XMLHelper _xml = new XMLHelper(path);
                _contents = _xml.GetNameValuePair("//Application", "Content", "name", "<innertext>");
            }
        }
        public static string GetContent(string contentName)
        {
            if (Contents.ContainsKey(contentName))
                return Contents[contentName];
            else return "";
        }
    }
}
